package com.xcc.fastblurc;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        img = findViewById(R.id.img);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.src1);
                doBlur();
            }
        });
    }

    private ImageView img;
    private Bitmap bitmap;

    private void doBlur() {
        long l = System.currentTimeMillis();
        Bitmap bitmap = new FastBlur().doBlur(this.bitmap, 20);
        long l2 = System.currentTimeMillis();
        long aLong = l2 - l;
        Log.v("--Main--", "耗时(ms):" + aLong);
        img.setImageBitmap(bitmap);
    }
}
